import Vue from 'vue'
import Router from 'vue-router'
import Home from '../components/home/home.vue'
import User from '../components/user/user.vue'
import Profile from '../components/user/profile.vue'
import Posts from '../components/user/posts.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      components: {
        main: Home
      }
    }, {
      path: '/user',
      name: 'User',
      components: {
        main: User
      },
      children: [{
        path: '', // 默认子路由
        redirect: 'profile'
      }, {
        path: 'profile',
        components: {
          user: Profile
        }
      }, {
        path: 'posts',
        components: {
          user: Posts
        }
      }]
    }
  ]
})
